import os

# Use debug flags
def getDebug():
    try:
        return int(os.environ[ 'DEBUG' ])
    except KeyError:
        return 0

env = Environment(ENV = os.environ)

if getDebug():
	cflags = ['-Wall', '-Wno-unused-variable', '-Wno-unused-function', '-funroll-loops', '-fexpensive-optimizations', '-g3', '-ggdb']
else: 
	cflags = ['-O2', '-Wall', '-Wno-unused-variable', '-Wno-unused-function', '-funroll-loops', '-fexpensive-optimizations']

env.Append(CCFLAGS = cflags)
env.ParseConfig('allegro-config --cflags --libs')

# Game
env.VariantDir('build','src', duplicate=0)
basserk_src = ['build/alleg.c', 'build/enemy.c', 'build/main.c', 'build/map.c', 'build/menus.c', 'build/player.c']
env.Program(target='basserk', source=basserk_src)

# Editor
env.VariantDir('build/editor','editor/src', duplicate=0)
editor_src = ['build/editor/alleg.c', 'build/editor/editor.c', 'build/editor/main.c', 'build/editor/map.c']
env.Program(target='basserk-editor', source=editor_src)